Designers of computer graphics applications continually strive to improve the realism of rendered scenes. For instance, computer game applications typically demand realism to increase the player's interest in the game, and hence, to enhance the marketability of the game. For example, game designers have been challenged to provide ever-increasing realism in such special effects as fire, explosions, smoke, fog, rain, lens flares, waves, etc. A first challenge is to devise a technique for simulating a special effect in the graphical realm. A second challenge is to implement this technique within the sometimes significant constraints of the hardware and processing limitations of a particular game-playing platform. More specifically, a designer may devise a theoretically sound technique for providing a special effect, but may find that the technique it is too “expensive” to implement within a particular game-playing platform. For instance, the technique may slow a game to an intolerable level, or may make too many demands on the game-playing platform's resources (such as the game-playing platform's memory resources).
An important special effect that contributes to the realism of a rendered scene is the generation of shadows. Several techniques exist for rendering shadows of objects within a scene. In a so-called “shadow volume” technique, the graphical application forms a polygonal volume to represent the shadow (referred to as a shadow volume). A stencil buffer can be used to determine what portions of the scene intersect with the shadow volume. In a so-called “shadow mapping” technique, the graphical application forms a two-dimensional distance texture map which represents the distances between different points on an object and a light source (when the object is viewed from the vantage point of the light source). This distance texture map is then projected onto the scene to determine portions of the scene that are inside a shadow cast by the object, and portions which are outside the shadow. While both of these techniques generate realistic shadows, they may fail to provide a sufficient degree of efficiency for all applications. More specifically, for relatively simple objects within a scene, a designer may wish to employ less precise methods for computing a shadow so as not to unduly slow the rendering of the scene.
Accordingly, there is an exemplary need in the art for an efficient technique for generating graphical effects, such as, but not limited to, shadow effects.